from servers.ServersFactory import ServersFactory
from protocol.ControlServerImpl import ControlServerImpl
from SowarnaMediator import SowarnaMediator
from SowarnaConfig import SowarnaDefaultConfig
import time, logging

def main():
    logging.basicConfig(level=logging.DEBUG)
    config = SowarnaDefaultConfig()
    mediator = SowarnaMediator(config)
    controlBackend = ControlServerImpl(mediator)
    mediator.setControlHandler(controlBackend)
    serversFactory = ServersFactory(config, controlBackend, cacheBackend=None, dataBackend=None)
    controlServer = serversFactory.createControlServer()
    controlServer.start()
    while True:
        time.sleep(5)

if __name__ == '__main__':
    main()